import Vue from "vue";
import VueRouter from "vue-router";
import LoginView from "@/views/login/LoginView";
import customerMain from "@/views/customer/customerMain";
import deliveryMain from "@/views/delivery/deliveryMain";
import commodityCate from "@/views/delivery/commodity/commodityCate";

Vue.use(VueRouter);

const routes = [
  // 登录页面路由
  {
    path: "/login",
    name: "login",
    component: LoginView,
  },
  //客户服务中心路由
  {
    path: "/customer",
    name: "customerMain",
    component: customerMain,
  },
  {
    path: "/delivery",
    name: "deliveryMain",
    component: deliveryMain,
    children: [
      {
        path: "/commodityCate",
        name: "commodityCate",
        component: commodityCate,
      },
    ],
  },
];

//异步挂载的路由
//动态需要根据权限加载的路由表
// export const asyncRouterMap = [
//   {
//     path: '/permission',
//     component: Layout,
//     name: '权限测试',
//     meta: { role: ['admin','super_editor'] }, //页面需要的权限
//     children: [
//       {
//         path: 'index',
//         component: Permission,
//         name: '权限测试页',
//         meta: { role: ['admin','super_editor'] }  //页面需要的权限
//       }]
//   },
//   { path: '*', redirect: '/404', hidden: true }
// ];

const router = new VueRouter({
  routes,
});

export default router;
